#!/bin/bash

PID_TO_MONITOR=$1
COMMAND_TO_EXECUTE=$2

if [ $# -ne 2 ]; then
    echo "Usage: $0 <PID_TO_MONITOR> <COMMAND_TO_EXECUTE>"
    exit 1
fi

while true; do
    if ! ps -p $PID_TO_MONITOR > /dev/null; then
        echo "Process $PID_TO_MONITOR not found. Executing command..."
        eval $COMMAND_TO_EXECUTE
        break
    fi
    sleep 600
done